﻿using System;
using System.Collections.Generic;
 
using System.Text;
using System.IO;

namespace GGSharp.Structures
{
    public class MessageImageReplyNext : StuctureBase
    {
        protected int _size;       	/* rozmiar */
        protected int _crc32;      	/* suma kontrolna */
        protected string _filename = "";
        protected byte[] _image;		/* zawartość obrazka, nie musi wystąpić */

        public MessageImageReplyNext() { }
        public MessageImageReplyNext(BinaryReader reader) : base(reader) { }

        public int CRC32
        {
            get { return _crc32; }
        }

        public string FileName
        {
            get { return _filename; }
        }

        public byte[] ImageData
        {
            get { return _image; }
        }

        public int Size
        {
            get { return _size; }
        }


        public override void Read(System.IO.BinaryReader reader)
        {
            _size = reader.ReadInt32();
            _crc32 = reader.ReadInt32();

            ReadedLength += 8;
            if (ReadedLength < Length)
            {
                _image = reader.ReadBytes(_size);
                ReadedLength += _size;
            }
        }

        public override void Write(System.IO.BinaryWriter writer)
        {
            throw new NotImplementedException();
        }
    }
}
